<script type="text/ng-template" id="modal.product.addProduct.html" size="modal-lg">
    <form class="form-horizontal">
        <div class="modal-header">
            <h3 class="modal-title">商品信息</h3>
            <small style="color:red">如果搜索无结果,请协助完善商品关键词,提升搜索精准度.</small>
        </div>
        <div class="modal-body">
            <div class="form-group">
                <div class="clearfix" style="margin-bottom: 10px">
                    <div class="col-md-2">
                        <select class="form-control" ng-model="type" ng-change="changeTypeValue()">
                            <option value="" label="关键字"></option>
                            <option value="item" label="商品id"></option>
                            <option value="list" label="列表id"></option>
                        </select>
                    </div>
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="{{typeHolder}}" ng-model="searchKeywords" autofocus>
                        <span class="input-group-btn">
                          <button class="btn btn-default" type="submit" ng-click="search(searchKeywords, type, selectBrand, selectSecondCategory, selectOrigin, false)">
                            <i class="fa fa-search"></i>
                          </button>
                        </span>
                    </div>
                </div>
                <ul class="row">
                    <li ng-repeat="productInfo in productInfoList" class="list-unstyled col-md-6">
                        <a class="col-md-3 thumbnail">
                            <img ng-src="{{productInfo.imgUrl}}@200h">
                            <div ng-if="getStatusOfItem(productInfo) == 1" class="icon icon-soldout icon-soldout-normal" style="">正常售罄</div>
                            <div ng-if="getStatusOfItem(productInfo) == 2" class="icon icon-soldout icon-soldout-normal" style="">一键售罄</div>
                            <div ng-if="getStatusOfItem(productInfo) == 3" class="icon icon-soldout icon-soldout-normal" style="">下架</div>
                        </a>
                        <ul class="col-md-9 list-unstyled">
                            <li style="overflow:hidden;text-overflow:ellipsis;display: -webkit-box;-webkit-line-clamp: 2; -webkit-box-orient: vertical;height:40px;">商品名：{{productInfo.name}}</li>
                            <li>库存：<strong>{{productInfo.stock}}</strong></li>
                            <li>价格：<strong>￥{{productInfo.price/100}}</strong></li>
                            <li>
                                <label>
                                    <input type="checkbox" ng-model="productInfo.checked">选中商品</label>
                            </li>
                        </ul>
                    </li>
                </ul>
                <center ng-if="type=='' && hasMore == true ">
                    <button class="btn btn-default" ng-click="search(searchKeywords, type, selectBrand, selectSecondCategory, selectOrigin, true)">加载更多</button>
                </center>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-default" ng-click="selectAll()" ng-disabled="!canSave">全选</button>
            <button class="btn btn-default" ng-click="selectInvert()" ng-disabled="!canSave">反选</button>
            <button class="btn btn-success" ng-click="save(productInfoList,true)" ng-disabled="!canSave">添加至末尾</button>
            <button class="btn btn-success" ng-click="save(productInfoList,false)" ng-disabled="!canSave">添加至开头</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
<script type="text/ng-template" id="modal.data.copy.html">
    <style>
    .ace_editor {
        height: 200px;
    }
    </style>
    <form class="form-horizontal">
        <div class="modal-header">
            <h3 class="modal-title">复制列表信息</h3>
        </div>
        <div class="modal-body">
            <div class="form-group">
                <label class="col-sm-2 control-label">复制列表id</label>
                <div class="col-sm-10">
                    <div>
                        <input type="text" class="form-control" ng-model="orgListId" autofocus>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-danger" ng-if="profile.role=='ADMIN'" ng-click="shareDataList(orgListId)" type="submit">共享列表</button>
            <button class="btn btn-danger" ng-click="replace(orgListId)" type="submit">覆盖当前列表</button>
            <button class="btn btn-success" ng-click="save(orgListId,true)" type="submit">复制至末尾</button>
            <button class="btn btn-success" ng-click="save(orgListId,false)" type="submit">复制至开头</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
<script type="text/ng-template" id="modal.data.add.html">
    <style>
    .ace_editor {
        height: 200px;
    }
    </style>
    <form class="form-horizontal">
        <div class="modal-header">
            <h3 class="modal-title">模块信息</h3>
        </div>
        <div class="modal-body">
            <div class="input-group custom-search-form" style="margin:10px;" ng-if="isProduct(items)">
                <input type="text" class="form-control" placeholder="商品itemId" ng-model="productlist">
                <span class="input-group-btn">
                    <button class="btn btn-default" type="button" ng-click="searchItems(productlist, $event)">
                        <i class="fa fa-search"></i>
                    </button>
                </span>
            </div>
            <div ng-repeat="item in items" class="form-group">
                <label class="col-sm-2 control-label" ng-model="item.fieldDescription">{{item.fieldDescription}}</label>
                <div class="col-sm-10">
                    <div class="modal-body" ng-if="item.fieldType == 'Html'">
                        <div ui-ace="{
            useWrapMode : true,
            showGutter: false,
            theme:'twilight',
            mode: 'xml',
            firstLineNumber: 5,
            onLoad: loaded,
            onChange: changed
            }" ng-model="item.propertyValue">
                        </div>
                    </div>
                    <div class="input-group" ng-if="item.fieldType == 'Image'">
                        <input type="text" class="form-control" ng-model="item.propertyValue">
                        <span class="input-group-btn">
            <button class="btn btn-default" ng-click="changeFile(item)" tabindex="0">
            <i class="glyphicon glyphicon-folder-open"></i>
            </button>
            <button class="btn btn-success" tabindex="0" ng-if="item.isCompleted == true">
            <i class="glyphicon glyphicon-ok"></i>
            </button>
          </span>
                    </div>
                    <div ng-if="item.fieldName == 'width'||item.fieldName == 'height'">
                        <input type="text" class="form-control" ng-model="item.propertyValue" placeholder="0" readonly="true">
                    </div>
                    <div ng-if="item.fieldType == 'Nation'">
                        <select class="form-control" ng-model="item.propertyValue" ng-options="nation.value as nation.key for nation in nations">
                        </select>
                    </div>
                    <div ng-if="item.fieldName == 'tag'">
                        <input type="text" class="form-control" ng-model="item.propertyValue" disabled>
                    </div>
                    <div ng-if="item.fieldType != 'Date'
          && item.fieldType != 'Html' && item.fieldType != 'Image' && item.fieldType != 'Nation' && item.fieldName != 'tag'&& item.fieldName != 'width'&&item.fieldName != 'height'">
                        <input type="text" class="form-control" ng-model="item.propertyValue" autofocus>
                    </div>
                    <div ng-if="item.fieldType == 'Date'">
                        <div class=' input-group date' ng-init="initTime()">
                            <input type='text' class="form-control datetimepicker datetimepicker{{$index}}" ng-model="item.propertyValue" ng-blur="dateChange(item,$index)" />
                            <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-success" ng-click="save(items)" type="submit">添加</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
<script type="text/ng-template" id="modal.data.info.html">
    <style>
    .ace_editor {
        height: 200px;
    }
    </style>
    <form class="form-horizontal" name="myForm">
        <div class="modal-header">
            <h3 class="modal-title">模块信息</h3>
        </div>
        <div class="modal-body">
            <div class="input-group custom-search-form" style="margin:10px;" ng-if="isProduct(items) == true">
                <input type="text" class="form-control" placeholder="商品itemId" ng-model="productlist">
                <span class="input-group-btn">
        <button class="btn btn-default" type="submit" ng-click="searchItems(productlist, $event)">
        <i class="fa fa-search"></i>
        </button>
      </span>
            </div>
            <div ng-repeat="item in items" class="form-group" ng-if="item.field.fieldDescription">
                <label class="col-sm-2 control-label" ng-model="item.propertyName">{{item.field.fieldDescription}}</label>
                <div class="col-sm-10" ng-if="item.field.fieldType == 'Html'">
                    <div ui-ace="{
            useWrapMode : true,
            showGutter: false,
            theme:'twilight',
            mode: 'xml',
            firstLineNumber: 5,
            onLoad: loaded,
            onChange: changed
            }" ng-model="item.propertyValue">
                    </div>
                </div>
                <div class="col-sm-10" ng-if="item.field.fieldType == 'Image'">
                    <div class="input-group">
                        <input type="text" class="form-control" ng-model="item.propertyValue">
                        <span class="input-group-btn">
              <button type="button" class="btn btn-default" ng-click="changeFile(item)" tabindex="0">
              <i class="glyphicon glyphicon-folder-open"></i>
              </button>
              <button type="button" class="btn btn-success" type="button" tabindex="0" ng-if="item.isCompleted == true">
              <i class="glyphicon glyphicon-ok"></i>
              </button>
            </span>
                    </div>
                </div>
                <div class="col-sm-10" ng-if="item.field.fieldName == 'width'||item.field.fieldName == 'height'">
                    <input type="text" class="form-control" ng-model="item.propertyValue" readonly="true">
                </div>
                <div class="col-sm-10" ng-if="item.field.fieldType == 'Nation'">
                    <select class="form-control" ng-model="item.propertyValue" ng-options="nation.value as nation.key for nation in nations">
                    </select>
                </div>
                <div class="col-sm-10" ng-if="item.field.fieldType != 'Date' && item.field.fieldType != 'Html' && item.field.fieldType != 'Image' && item.field.fieldType != 'Nation' && item.field.fieldName != 'width'&&item.field.fieldName != 'height'">
                    <input type="text" class="form-control" ng-model="item.propertyValue" autofocus onfocus="this.select()">
                </div>
                <div class="col-sm-10" ng-if="item.field.fieldType == 'Date'">
                    <div class='input-group date' ng-init="initTime()">
                        <input type='text' class="form-control datetimepicker datetimepicker{{$index}}" ng-model="item.propertyValue" ng-blur="dateChange(item,$index)" />
                        <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-success" ng-disabled="myForm.$invalid" ng-click="save()" type="submit">修改</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
        </div>
    </form>
</script>
<script type="text/ng-template" id="modal.data.bantchupdatedata.html">
    <style>
    .ace_editor {
        height: 200px;
    }
    </style>
    <form class="form-horizontal">
        <div class="modal-header">
            <h3 class="modal-title">批量修改属性</h3>
        </div>
        <div class="modal-body">
            <div class="form-group" ng-init="init()">
                <div class="clearfix" style="margin-bottom: 10px">
                    <div class="col-md-2">
                        <select class="form-control" ng-model="selectedField" ng-options="field as field.fieldDescription for field in fields">
                        </select>
                    </div>
                    <div class="col-md-10">
                        <select class="form-control" ng-model="propertyValue" ng-options="nation.value as nation.key for nation in nations" ng-show="selectedField.fieldType == 'Nation'" autofocus>
                        </select>
                        <div class='input-group date' ng-init="initTime()" ng-show="selectedField.fieldType == 'Date'">
                            <input type='text' class="form-control datetimepicker" ng-model="propertyValue" ng-blur="dateChange()" />
                            <span class="input-group-addon">
                          <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </div>
                        <input type="text" class="form-control" ng-model="propertyValue" ng-show="selectedField.fieldType != 'Nation'&&selectedField.fieldType != 'Date'" autofocus>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-success" ng-click="save()" type="submit">保存</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
